package pl.edu.agh.gameserv.server.test.helper;

import java.util.List;

import pl.edu.agh.gameserv.server.test.GameStatus;
import pl.edu.agh.gameserv.server.test.ServerImpl;
import pl.edu.agh.gameserv.server.test.StringArray;
public class User {
	private final static String GAME_NAME = "Tic-tac-toe";
	private String name;
	private ServerImpl server;
	private int gameHandler;

	public User(String name, ServerImpl server) {
		this.name = name;
		this.server = server;
	}

	public int getNumberOfGames() {
		return server.getGameTypes().size();
	}

	public void joinGame() {
		gameHandler = server.startGame(GAME_NAME, name);
	}

	public GameStatus getState() {
		return server.getGameStatus(gameHandler);
	}

	public String makeMove(String move) throws Exception {
		return server.makeMove(gameHandler, move).toString();
	}

	public String getScore() {
		return server.getScore(gameHandler);
	}

	public int getGameHandler() {
		return gameHandler;
	}

	public void exit() {
		server.exit(gameHandler);
	}

	public List<StringArray> getSituation() {
		return server.getSituation(gameHandler);
	}

}
